/**
 * 详情对话框
 */
var BasicOperateInfoDlg = {
    data: {
        operateName: "",
        operateContacts: "",
        operateTel: "",
        operateEmall: "",
        operateProvinces: "",
        operateCiywhere: "",
        operateBank: "",
        operateBankaccount: "",
        operateCreditcode: "",
        operateAddress: "",
        operateNotes: "",
        version: "",
        createTime: "",
        updateTime: "",
        createUser: "",
        updateUser: ""
    }
};

/**
* 角色详情对话框
*/
var DeptInfoDlg = {
   data: {
       pid: "",
       pName: ""
   }
};

layui.use(['form', 'admin', 'ax'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    //获取详情信息，填充表单
    var ajax = new $ax(Feng.ctxPath + "/basicOperate/detail?id=" + Feng.getUrlParam("id"));
    var result = ajax.start();
    form.val('basicOperateForm', result.data);

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/basicOperate/editItem", function (data) {
            Feng.success("更新成功！");
            window.location.href = Feng.ctxPath + '/basicOperate'
        }, function (data) {
            Feng.error("更新失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

    /*$.ajax({
        url: Feng.ctxPath + "/sysCompany/list2",
        dataType: 'json',
        type: 'get',
        async:false,
        success: function (data) {
            console.log(data);
            //使用循环遍历，给下拉列表赋值
            var select = document.getElementById('coId');
            data.forEach(function (item) {
                var option = document.createElement("option");
                option.value = item.id; // 设置选项的值
                option.text = item.coName;
                select.add(option);
            });
            layui.form.render("select");
        }
    });*/

    //返回按钮
    $("#backupPage").click(function () {
        window.location.href = Feng.ctxPath + '/basicOperate'
    });

});